// Copyright (c) Appeon. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

namespace SnapObjects.Data
{
    internal class InsertBuildStatement : SqlBuildStatement
    {
        public InsertBuildStatement()
        {
            this.Table = new SqlBuildClause(this.OnChanged);
            this.Columns = new SqlBuildClause(this.OnChanged);
        }

        public override SqlStatementType StatementType => SqlStatementType.Insert;

        public SqlBuildClause Table { get; private set; }

        public SqlBuildClause Columns { get; private set; }

        public override SqlBuildStatement Clone()
        {
            var statement = new InsertBuildStatement();

            statement.Table = this.Table.Clone(statement.OnChanged);
            statement.Columns = this.Columns.Clone(statement.OnChanged);

            return statement;
        }

        public override void Clear()
        {
            base.Clear();

            this.Table.Clear();
            this.Columns.Clear();

            _parameters.Clear();
        }
    }
}
